package fr.enseirbmatmeca.apms.spring.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import fr.enseirbmatmeca.apms.spring.model.project.Project;
import fr.enseirbmatmeca.apms.spring.model.project.ProjectCollection;
import fr.enseirbmatmeca.apms.spring.model.project.ProjectGroup;
import fr.enseirbmatmeca.apms.spring.model.user.User;

/**
 * This interface publishes features to handler projects
 * @author coudar
 */

public interface ProjectManager {

	@Transactional (readOnly=false)
	public String assignProject(User user, Project project, int role);
	
	/**
	 * Check if the project exists if it doesn't
	 * it persists the project in database if it is coherent or return an error message
	 * @param user project to persist in database
	 * @return any error message if necessary else null
	 */
	@Transactional (readOnly=false)
	public String createProject(Project project);

	@Transactional (readOnly=false)
	public String CreateProjectCollection(ProjectCollection pc);
	
	@Transactional (readOnly=false)
	public String CreateProjectGroup(ProjectGroup pg);
	
	@Transactional (readOnly=false)
	public String createTag(String tag);
	
	@Transactional (readOnly=false)
	public String deleteProject(Project project);
	
	@Transactional (readOnly=false)
	public String deleteProjectCollection(ProjectCollection project);
	
	@Transactional (readOnly=false)
	public String deleteTag(String tag);
	
	public ProjectCollection getProjectCollection();
	
	public ProjectCollection getProjectCollection(User user);
	
	public List<Project> getProjects ();

	/**
	 * return every project an user can access so that for example he can join it
	 * or see its details etc... 
	 * @param user the user concerned
	 * @return the project list restricted to the user access
	 */
	public List<Project> getProjects (User user);
	
	public boolean sendEmailWarningUnuploadedReports();
	
	@Transactional (readOnly=false)
	public String setProjectStatusByTag(int projectStatus, String tag);
	
	@Transactional (readOnly=false)
	public String updateProject(Project project);
	
	public boolean checkProjectIntoProjectCollection(String projectId, String projectCollectionId);
	public boolean checkProjectIntoProjectGroup(String projectId, String projectGroupId);
	
}